import { post, get } from "@/utils/request";

const attendExam = (params) => post("/exam/attend", params);
const commitPractice = (params) => post("/practice/commit", params);
const markAnswer = (params) => post("/answer/mark", params);
const getExams = ({ studentId, current, size }) => get(`/exam/${studentId}/${current}/${size}`);
const finishExam = (params) =>
  post(
    `/exam/finish/${params.studentId}/${params.examId}`,
    params.answer || []
  );
const getScores = ({ examId, current, size }) =>
  get(`/score/${examId}/${current}/${size}`);
const getAnswers = ({ studentId, examId, current, size }) =>
  get(`/answer/${studentId}/${examId}/${current}/${size}`);
const getScore = ({ studentId, examId }) =>
  get(`/score/compute/${studentId}/${examId}`);

export {
  attendExam,
  commitPractice,
  markAnswer,
  getExams,
  finishExam,
  getScores,
  getAnswers,
  getScore,
};
